package util
{
	import flashx.textLayout.formats.Float;

	public class DealWithData
	{
		public function DealWithData()
		{
			
		}
		
		public function FigurePeiZhiNum(planPeiZhi:String):String
		{
			var peizhi:int = 0;
			var results:Array;
			results=planPeiZhi.split('/');
			var count:int=results.length;
			for(var i:int=0;i<count;i++)
			{
				if(results[i]!="")
				{
					peizhi += int(results[i]);
				}
			}
			return String(peizhi);
		}
		
		public function GetDistance(pLongitude:Number,pLatitude:Number,Longitude:Number,Latitude:Number):String
		{
			var distance:Number = 0;
			var x:Number = 0;
			var y:Number = 0;
			x = (Math.sin((90-Latitude)*2*Math.PI/360)+
				Math.sin((90-pLatitude)*2*Math.PI/360))/2 * (Longitude - pLongitude)/360 * 40075360;
			y = (Latitude - pLatitude) / 360 * 39940670;
			distance = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
			return distance.toFixed(6);
		}
	}
}